
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Setup and Maintenance · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="UpgradingFrom05.html" />
    
    
    <link rel="prev" href="./" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="SetupMaintenance.html">
            
                <a href="SetupMaintenance.html">
            
                    
                    Setup and Maintenance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="UpgradingFrom05.html">
            
                <a href="UpgradingFrom05.html">
            
                    
                    Upgrading from Misago 0.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="ref/">
            
                <a href="ref/">
            
                    
                    References
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="ref/Settings.html">
            
                <a href="ref/Settings.html">
            
                    
                    Settings
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Setup and Maintenance</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="setup-and-maintenance">Setup and Maintenance</h1>
<p>Misago is Python and Django application which means system requirements as well as setup process and way maintenace taks are performed may appear confusing and suprising to administrators that have no experience outside of running PHP solutions.</p>
<h2 id="installing-misago">Installing Misago</h2>
<p>Misago installation is three step process. First you compare your server&apos;s specification to check if will be able to run Misago. Next you setup Misago and all extra services required for it to function like e-mails, database and automatic maintenance tasks. Finally you get your site running and accessible for your users.</p>
<h3 id="requirements">Requirements</h3>
<p>Before you start make sure your hosting provider grants you:</p>
<ul>
<li>SSH access to the server</li>
<li>Python 2.7, 3.4, 3.5 or 3.6</li>
<li>PostgreSQL &gt;= 9.4</li>
<li>At least 128 megabytes of free memory for Misago&apos;s processes</li>
<li>HTTP server that supports WSGI applications (like NGINX with UWSGI or Apache2 with mod_wsgi)</li>
<li>Crontab</li>
</ul>
<p>This isn&apos;t an issue on VPS or dedicated servers, but availability of shared servers that meet those requirements differs wildly depending on your location.</p>
<p>Speaking of shared servers, ability to download, compile and run software from internet may be needed, but different ISP&apos;s have different approach to this. Some options come with all dependencies preinstalled, others let you install them yourself and others require you to mail them every time you need something installed. Generally you should avoid offers coming from last group because this turns running Python apps into a hore.</p>
<h3 id="setup">Setup</h3>
<p>To install Misago setup and activate virtual environment for your site and then fire following command::</p>
<pre><code>pip install misago --pre
</code></pre><p>This will install Misago in your virtual environment and make &quot;misago-start.py&quot; script available for you to use to create pre-configured Misago site.</p>
<p>Now decide on your site&apos;s module name. This name will be used for python module that will contain your configuration files. This means it should be only latin lowercase letters and (optionally) digits or underscore sign (&quot;_&quot;). Good idea is to use your domain name as source for project namespace, for example turning &quot;misago-forum.org&quot; into &quot;misagoforumorg&quot;.</p>
<p>Once you&apos;ve decided on your name, create your site configuration module. In example we assume your site will be named &quot;misagoforumorg&quot;::</p>
<pre><code>misago-start.py misagoforumorg
</code></pre><p>This will create directory &quot;misagoforumorg&quot; in your working directory. Inside you will find following items:</p>
<ul>
<li><p><code>manage.py</code> script that you can use to run administrative commands Misago provides as well as access its python shell which is usefull for quick and dirty administration work.</p>
</li>
<li><p><code>cron.txt</code> that contains example crontab configuration for automating maintenance tasks on your site.</p>
</li>
<li><p><code>avatargallery</code> directory that contains example avatar gallery you may load using <code>manage.py</code> script to run <code>loadavatargallery</code> task that will load it into avatar gallery.</p>
</li>
<li><p><code>media</code> directory for user uploaded files.</p>
</li>
<li><p><code>misagoforumorg</code> python module with configuration files for your site.</p>
</li>
<li><p><code>static</code> directory for static assets like css, js or images.</p>
</li>
<li><p><code>theme</code> directory for overriding default assets with your own ones.</p>
</li>
</ul>
<p>We will get to <code>misagoforumorg</code> in a minute, but before that lets spend few more moments in our current location.</p>
<p>This directory has special purpose. It serves as &quot;container&quot; for your customizations for Misago. If you want to install extension or plugin that has no &quot;setup.py&quot; of its own or use custom styles or templates on your site, you will put them there, making them easily accessible for your Misago installation.</p>
<p>Let&apos;s go deeper. Change your current directory to &quot;misagoforumorg&quot;. By default this directory will contain four files: &quot;<strong>init</strong>.py&quot;, thats special file that tells python this directory is python package, &quot;settings.py&quot; that contains all low-level settings of your site, &quot;urls.py&quot; that tells your forum about links on your site and finally &quot;wsgi.py&quot;, thats special file servers use to understand and talk with your application. Unless you are building entire site around your forum, you can ignore &quot;urls.py&quot;.</p>
<p>Open &quot;settings.py&quot; in your code editor of choice and give a look in values listed here. Each value is accompanied by commentary explaining its purpose. See if any tuning is needed, then save your changes and leave editor.</p>
<p>.. note::
   To simplify setup process, by default &quot;settings.py&quot; file contains only most basic settings that are needed for your site to run, with everything else being set for you automatically at the beginning of file.</p>
<p>Move back to directory with manage.py and use it to initialize Misago database by firing migrate::</p>
<pre><code>python manage.py migrate
</code></pre><p>Next, call createsuperuser command to create super admin in database::</p>
<pre><code>python manage.py createsuperuser
</code></pre><p>Finally, start development server using &quot;runserver&quot; command::</p>
<pre><code>python manage.py runserver
</code></pre><p>If server starts, you should be able to visit 127.0.0.1:8000 in your browser and see forum index, however as work on project is underway revisions may frequently introduce changes that will break runserver.</p>
<h3 id="deployment">Deployment</h3>
<p>Deployment is a process in which you get your site running and reachable by your users.</p>
<p>Misago is de facto Django with extra features added. This means deployment of Misago should be largery same to deployment of other Django-based solutions. Django documentation <a href="https://docs.djangoproject.com/en/1.6/howto/deployment/" target="_blank">already covers</a> supported deployment methods, and while on dedicated and VPS options deployment method depends largery on your choice and employed software stack, shared servers may differ greatly by the way how Django should be deployed. If thats the case, make sure you consult your ISP documentation and/or ask its rep for details about supported deployment method.</p>
<p>If you need example, UWSGI project&apos;s documentation has tutorial on configuring NGINX with UWSGI to run <a href="http://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html" target="_blank">django applications</a>.</p>
<h3 id="securing-mediaroot">Securing MEDIA_ROOT</h3>
<p>By default Misago uses the <code>FileSystemStorage</code> strategy that stores user-uploaded files in your site&apos;s <code>media</code> directory. You need to make sure that you have disabled indexing/listing of this directory contents in your HTTP server&apos;s settings, or your user-uploaded files will be easily discoverable from internet. This is especially important because Misago has no special protection system in place for uploaded files.</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="./" class="navigation navigation-prev " aria-label="Previous page: Introduction">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="UpgradingFrom05.html" class="navigation navigation-next " aria-label="Next page: Upgrading from Misago 0.5">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Setup and Maintenance","level":"1.2","depth":1,"next":{"title":"Upgrading from Misago 0.5","level":"1.3","depth":1,"path":"UpgradingFrom05.md","ref":"./UpgradingFrom05.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"SetupMaintenance.md","mtime":"2017-01-25T21:15:36.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-01-25T21:11:57.373Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

